package jdbctest;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class JDBCDemo2 {
    public static void main(String[] args) {
        try(Connection connection = DBUtil.getConnection()) {
            Statement statement = connection.createStatement();
            String sql = "INSERT INTO user(username,password,nickname,age)"+
                    "VALUES('张三','123456','阿三',20)";
            int num = statement.executeUpdate(sql);
            System.out.println(num > 0? "插入成功":"插入失败");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
